package net.siufung.security.base.exception.catetory;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import net.siufung.core.result.ResultFail;
import net.siufung.security.base.exception.Oauth2Exception;
import net.siufung.security.base.exception.Oauth2ExceptionSerializer;
import org.springframework.http.HttpStatus;

/**
 * @author 陈建峰
 * @since 2022/3/2 1:38 下午
 */
@JsonSerialize(using = Oauth2ExceptionSerializer.class)
public class UsernameOrPasswordErrorException extends Oauth2Exception {

    private static final long serialVersionUID = 6294672765927591780L;

    public UsernameOrPasswordErrorException() {
        super(ResultFail.AUTH_USERNAME_OR_PASSWORD_ERROR.getMessage());
    }

    public UsernameOrPasswordErrorException(String msg) {
        super(msg);
    }

    @Override
    public String getOAuth2ErrorCode() {
        return "username_or_password_error";
    }

    @Override
    public int getHttpErrorCode() {
        return HttpStatus.OK.value();
    }

}
